package ${classPath};


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 

import lombok.Data;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;

@Data
public class ${domain}Query {
 
<#list fieldList as field>

<#compress>
  /** ${field.comment} */
  private ${field.type} ${field.name};
</#compress>

<#if field.name?ends_with("ype") || field.name?ends_with("tatus")>
  
  /** 排除${field.comment} */
  @Size(max = 5)
  private Set<${field.type}> exclude${field.name?cap_first};
 
  /** 包含${field.comment} */
  @Size(max = 5)
  private Set<${field.type}> include${field.name?cap_first};
</#if>
</#list>

	/** 创建时间 */
	private LocalDateRange createTime;

	public Wrapper<${domain}> getQueryWrapper() {
		LambdaQueryWrapper<${domain}> queryWrapper = new LambdaQueryWrapper<>(); 

  <#list fieldList as field>
        <#if field.type?starts_with("String")>
      /** ${field.comment} */
      if (StringUtils.isNotEmpty(${field.name})) {
        queryWrapper.eq(${domain}::get${field.name?cap_first}, get${field.name?cap_first}());
      }
        <#else>
      /** ${field.comment} */
      if (${field.name} != null) {
        queryWrapper.eq(${domain}::get${field.name?cap_first}, get${field.name?cap_first}());
      }
        </#if>
  </#list>
 



		// 创建时间
		if (createTime != null && createTime.getStart() != null) {
			queryWrapper.ge(${domain}::getCreateTime, createTime.getStart());
		}
		if (createTime != null && createTime.getEnd() != null) {
			queryWrapper.le(${domain}::getCreateTime, createTime.getEnd());
		}

		return queryWrapper;
	}
}
